import Vue from 'vue'
import Vuex from 'vuex'


Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        list: []

    },
    mutations: {
        // addAcc(state, payload) {
        //     payload.count++

        // },
        addTo(state, payload) {
            payload.chenk = false
            state.list.push(payload)


        }


    },
    actions: {
        addCart(context, payload) {
            // let oldList = context.state.list.find(itme => itme.id === payload.id)

            // if (oldList) {
            //     //  oldList.count += 1
            //     context.commit('addAcc', oldList)
            // } else {
            //     payload.count = 1
                //  context.state.list.push(payload)
                context.commit('addTo', payload)
            // }

        }
    }
})
export default store